Open Bug 1514279 Opened 6 years ago Updated 8 months ago

./mach clang-format should be better documented and/or use the same syntax/options for which files to modify as ./mach lint

Categories

(Developer Infrastructure :: Lint and Formatting, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: Gijs, Unassigned)

References

(Depends on 1 open bug)

Details

./mach clang-format says it runs "on current changes", but doesn't specify what that means. It takes looking at the source that by this it means "the working dir and the parent commit" (`diff -r .^`) . This is confusing, because e.g.: 1. on a stack of commits and with a clean working dir, it only does something for the top commit. 2. when you're one commit above m-c, and you histedit (so dirty working dir, parent commit == m-c), it'll touch whatever files are in the parent commit which isn't mine. Comically, I was very confused in https://phabricator.services.mozilla.com/D13260#inline-77713 because I'd run ./mach clang-format after committing both commits in the stack, and that did nothing. After kats' comments, I tried to use histedit, and ran it before re-committing / `hg histedit --continue`ing , but then it ran against my local changes for that would-be-commit plus the m-c changeset on which I based my changes, which looked like this: M browser/components/extensions/test/browser/browser_ext_popup_background.js M browser/locales/en-US/browser/preferences/preferences.ftl M dom/base/Element.cpp M dom/base/Element.h M dom/base/FragmentOrElement.cpp M dom/base/FragmentOrElement.h M dom/base/test/test_bug564863.xhtml M dom/security/test/general/browser.ini M dom/tests/mochitest/general/test_offsets.js M js/public/TraceKind.h M js/src/gc/Marking.cpp M layout/reftests/cssom/computed-style-cross-window-ref.html M layout/reftests/cssom/computed-style-cross-window.html M layout/style/nsComputedDOMStyle.cpp M layout/style/test/chrome/bug418986-2.js M layout/style/test/test_bug1203766.html M layout/style/test/test_default_bidi_css.html M servo/components/style/gecko/wrapper.rs M testing/web-platform/meta/css/cssom/getComputedStyle-detached-subtree.html.ini M testing/web-platform/tests/css/css-fonts/font-variant-alternates-parsing.html M toolkit/components/extensions/test/browser/browser_ext_themes_autocomplete_popup.js M toolkit/components/extensions/test/browser/browser_ext_themes_sanitization.js M toolkit/components/perfmonitoring/tests/browser/browser.ini M toolkit/modules/LightweightThemeConsumer.jsm ( a52c254930e8 , a merge commit... ) so I ended up modifying js/public/TraceKind.h and dom/base/Element.h ... which have nothing to do with my patch. Please sync up behaviors with ./mach lint and/or ./mach lint --outgoing . And update the `description` at https://dxr.mozilla.org/mozilla-central/rev/c2593a3058afdfeaac5c990e18794ee8257afe99/python/mozbuild/mozbuild/mach_commands.py#2334 because the status quo is super footgunny.
I think syncing the behaviour with ./mach lint is a great idea.
Flags: needinfo?(gijskruitbosch+bugs)
Keywords: in-triage
Hi Kim, did you mean to ask me a question to go with the needinfo? :-)
Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(kmoir)
sorry I was going to ask a question but then reconsidered, please ignore it.
Flags: needinfo?(kmoir)
Component: Mach Core → Lint and Formatting
Keywords: in-triage
Priority: -- → P3
See Also: → 1523073
Product: Firefox Build System → Developer Infrastructure
Severity: normal → S3
See Also: → 1545276
Depends on: 1670949
You need to log in before you can comment on or make changes to this bug.